<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
      xmlns:jsf="http://xmlns.jcp.org/jsf"
      xmlns:pt="http://java.sun.com/jsf/passthrough"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:o="http://omnifaces.org/ui"
      xmlns:iqbs="http://xmlns.jcp.org/jsf/composite/iqbs">
    <h:head>
    </h:head>

    <h:body>
        <ui:composition template="/dataverse_template.xhtml">
            <ui:param name="pageTitle" value="#{FilePage.fileMetadata.dataFile.displayName} - #{FilePage.file.owner.owner.displayName}"/>
            <ui:param name="dataverse" value="#{FilePage.file.owner.owner}"/>
            <ui:param name="showDataverseHeader" value="#{!FilePage.isAnonymizedAccess()}"/>
            <ui:param name="showMessagePanel" value="#{true}"/>
            <!-- NOTE removed fileAccessRequest logic in order to always display the file access btn -->
            <ui:param name="showAccessFileButtonGroup" value="#{!FilePage.fileMetadata.datasetVersion.deaccessioned
                                                                or (FilePage.fileMetadata.datasetVersion.deaccessioned
                                                                and permissionsWrapper.canIssueUpdateDatasetCommand(FilePage.fileMetadata.datasetVersion.dataset))}"/>
            <ui:define name="meta_header">
            <meta name="description" content="#{FilePage.fileMetadata.description}"/>
            </ui:define>
            <ui:define name="metadata">
                <f:metadata>
                    <o:viewParam name="fileId" value="#{FilePage.fileId}"/>
                    <f:viewParam name="version" value="#{FilePage.version}"/>
                    <o:viewParam name="toolType" value="#{FilePage.toolType}"/>
                    <f:viewParam name="persistentId" value="#{FilePage.persistentId}"/>
                    <f:viewParam name="datasetVersionId" value="#{FilePage.datasetVersionId}"/>
                    <f:viewAction action="#{dataverseSession.updateLocaleInViewRoot}"/>
                    <f:viewAction action="#{FilePage.init}"/>
                    <f:viewAction action="#{dataverseHeaderFragment.initBreadcrumbsForFileMetadata(FilePage.fileMetadata)}"/>
                </f:metadata>
            </ui:define>
            <ui:define name="body">
                <h:form id="fileForm">
                    <!-- Top Button/Citation Blocks -->
                    <div id="fileVersionBlock" class="row">
                        <div class="col-xs-12">
                            <div class="row">
                                <div id="file-title-block" class="col-xs-12 margin-bottom-half">
                                    <span class="file-title-label">#{FilePage.fileMetadata.label}</span>

                                    <!-- FILE LEVEL MSGs -->
                                    <div class="bg-info text-info text-center margin-bottom-half" jsf:rendered="#{FilePage.fileMetadata.dataFile.ingestProblem and FilePage.canUpdateDataset()}">
                                        <!-- Ingest failed -->
                                        <span class="glyphicon glyphicon-info-sign"/>
                                        <span> #{bundle['file.ingestFailed.header']}&#160;</span>
                                        <span>
                                            <a tabindex="0" role="button" class="glyphicon glyphicon-question-sign tooltip-icon"
                                               data-toggle="popover" data-placement="auto top" data-trigger="focus" data-html="true"
                                               data-content="#{FilePage.ingestMessage} #{FilePage.fileMetadata.dataFile.ingestReportMessage}"/>
                                        </span>
                                    </div>
                                    <!-- END: FILE LEVEL MSGs -->

                                    <p class="help-block">
                                        <h:outputFormat value="#{bundle['file.citation.notice']}" escape="false">
                                            <o:param value="#{FilePage.fileMetadata.datasetVersion.dataset.displayName}"/>
                                        </h:outputFormat>
                                    </p>

                                    <div id="title-label-block" class="margin-top-half">

                                        <!-- Restricted File Icon -->
                                        <span class="glyphicon glyphicon-lock text-danger" title="#{bundle['restricted']}" data-toggle="tooltip" jsf:rendered="#{FilePage.fileMetadata.restricted and !(fileDownloadHelper.canDownloadFile(FilePage.fileMetadata))}"/>
                                        <span class="icon-unlock text-success" title="#{bundle['restrictedaccess']}" data-toggle="tooltip" jsf:rendered="#{FilePage.fileMetadata.restricted  and fileDownloadHelper.canDownloadFile(FilePage.fileMetadata) }"/>
                                        <o:importFunctions type="edu.harvard.iq.dataverse.dataset.DatasetUtil" />
                                        
                                        <!-- DATASET Publication Status -->
                                        <h:outputText value="#{bundle['dataset.versionUI.draft']}" styleClass="label label-primary" rendered="#{FilePage.fileMetadata.datasetVersion.draft}"/>
                                        <h:outputText value="#{bundle['embargoed']}" styleClass="label label-primary" rendered="#{dataFileServiceBean.isActivelyEmbargoed(FilePage.fileMetadata)}"/>
                                        <h:outputText value="#{bundle['retentionExpired']}" styleClass="label label-danger" rendered="#{dataFileServiceBean.isRetentionExpired(FilePage.fileMetadata)}"/>
                                        <h:outputText value="#{bundle['dataset.versionUI.inReview']}" styleClass="label label-success" rendered="#{FilePage.fileMetadata.datasetVersion.inReview}"/>
                                        <h:outputText value="#{bundle['dataset.versionUI.unpublished']}" styleClass="label label-warning" rendered="#{!FilePage.fileMetadata.datasetVersion.dataset.released}"/>
                                        <h:outputText value="#{bundle['dataset.versionUI.deaccessioned']}" styleClass="label label-danger" rendered="#{FilePage.fileMetadata.datasetVersion.deaccessioned}"/>
                                        <h:outputText value="#{DatasetUtil:getLocaleCurationStatusLabel(FilePage.fileMetadata.datasetVersion.currentCurationStatus)}" styleClass="label label-info curation-status" rendered="#{FilePage.canSeeCurationStatus()}"/>
                                        <h:outputText value="#{bundle['incomplete']}" styleClass="label label-danger" rendered="#{!FilePage.valid}"/>
                                        <!-- DATASET VERSION NUMBER -->
                                        <h:outputText styleClass="label label-default" rendered="#{FilePage.fileMetadata.datasetVersion.released and !(FilePage.fileMetadata.datasetVersion.draft or FilePage.fileMetadata.datasetVersion.inReview)}"
                                                      value="#{bundle['file.DatasetVersion']} #{FilePage.fileMetadata.datasetVersion.versionNumber}.#{FilePage.fileMetadata.datasetVersion.minorVersionNumber}"/>
                                        <h:outputText styleClass="label label-default" rendered="#{!FilePage.fileMetadata.datasetVersion.released and !(FilePage.fileMetadata.datasetVersion.draft or FilePage.fileMetadata.datasetVersion.inReview)}"
                                                      value="#{bundle['file.DatasetVersion']} #{FilePage.fileMetadata.datasetVersion.versionState}"/>
                                    </div>
                                </div>
                            </div>

                            <!-- START: NEW RESPONSIVE ABOVE FOLD BLOCK -->
                            <div class="row">
                                <!-- CITATION BLOCK -->
                                <div class="col-xs-12 col-sm-12 col-md-8 col-lg-9">
                                    <!-- FILE CITATION -->
                                    <h:outputFormat styleClass="h5" value="#{bundle['file.citation.datafile']}" escape="false" />
                                    <div class="citation-block">
                                        <div class="clearfix #{FilePage.fileMetadata.datasetVersion.deaccessioned ? 'alert alert-danger bg-danger' : 'alert alert-info bg-citation bg-citation-file'}">
                                            <div class="citation #{FilePage.fileMetadata.datasetVersion.deaccessioned ? '' : 'margin-bottom'}">
                                                <span id="citation-select-2" onclick="if (event.target) { selectText(event.target); } else{ selectText(this); }">
                                                    <h:outputText value="#{FilePage.fileMetadata.dataFile.isIdentifierRegistered() ? FilePage.fileMetadata.getDirectFileCitation(true, FilePage.anonymizedAccess) : FilePage.fileMetadata.getFileCitation(true, FilePage.anonymizedAccess)}" escape="false"/>
                                                </span>
                                                <span class="glyphicon glyphicon-question-sign text-primary" jsf:rendered="#{!FilePage.fileMetadata.datasetVersion.dataset.released}"
                                                      data-toggle="tooltip" data-placement="top" data-original-title="#{bundle['dataset.cite.title.released']}"/>
                                                <span class="glyphicon glyphicon-question-sign text-primary" jsf:rendered="#{FilePage.fileMetadata.datasetVersion.dataset.released and FilePage.fileMetadata.datasetVersion.draft}"
                                                      data-toggle="tooltip" data-placement="top" data-original-title="#{bundle['dataset.cite.title.draft']}"/>
                                            </div>
                                            <div class="pull-left row col-sm-9 padding-none" jsf:rendered="#{!FilePage.anonymizedAccess}">
                                                <div class="col-sm-3 col-md-4 col-lg-3 btn-group margin-bottom citation-download" jsf:rendered="#{!FilePage.fileMetadata.datasetVersion.deaccessioned}">
                                                    <button type="button" class="btn btn-link dropdown-toggle padding-none downloadCitation" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                         #{bundle['file.cite.file.downloadBtn']} <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu">
                                                        <li>
                                                            <h:commandLink
                                                                id="endNoteLink-2" value="#{bundle['dataset.cite.downloadBtn.xml']}"
                                                                action="#{FilePage.fileDownloadService.downloadCitationXML(FilePage.fileMetadata, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
                                                            />
                                                        </li>
                                                        <li>
                                                            <h:commandLink
                                                                id="risLink-2" value="#{bundle['dataset.cite.downloadBtn.ris']}"
                                                                action="#{FilePage.fileDownloadService.downloadCitationRIS(FilePage.fileMetadata, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
                                                            />
                                                        </li>
                                                        <li>
                                                            <h:commandLink
                                                                id="bibLink-2" value="#{bundle['dataset.cite.downloadBtn.bib']}" target="_blank"
                                                                action="#{FilePage.fileDownloadService.downloadCitationBibtex(FilePage.fileMetadata, FilePage.fileMetadata.dataFile.isIdentifierRegistered())}"
                                                            />
                                                        </li>
                                                    </ul>
                                                </div>
                                                <div class="col-sm-9 col-md-8 col-lg-9 text-muted margin-bottom citation-standards" jsf:rendered="#{!FilePage.fileMetadata.datasetVersion.deaccessioned}">
                                                    <h:outputText value="#{bundle['dataset.cite.standards.tip']}" escape="false"/>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- END: FILE CITATION -->

                                    <!-- DATASET CITATION -->
                                    <h:outputFormat styleClass="h5" value="#{bundle['file.citation.dataset']}" escape="false" />
                                    <div class="citation-block no-margin-bottom">
                                        <div class="clearfix #{FilePage.fileMetadata.datasetVersion.deaccessioned ? 'alert alert-danger bg-danger' : 'alert alert-info bg-citation'}">
                                            <div class="citation #{FilePage.fileMetadata.datasetVersion.deaccessioned ? '' : 'margin-bottom'}">
                                                <span class="citation-select" onclick="if (event.target) { selectText(event.target); } else{ selectText(this); }">
                                                    <h:outputText value="#{FilePage.fileMetadata.datasetVersion.getCitation(true, FilePage.anonymizedAccess)}" escape="false"/>
                                                </span>
                                                <span class="glyphicon glyphicon-question-sign text-primary" jsf:rendered="#{!FilePage.fileMetadata.datasetVersion.dataset.released}"
                                                      data-toggle="tooltip" data-placement="top" data-original-title="#{bundle['dataset.cite.title.released']}"/>
                                                <span class="glyphicon glyphicon-question-sign text-primary" jsf:rendered="#{FilePage.fileMetadata.datasetVersion.dataset.released and FilePage.fileMetadata.datasetVersion.draft}"
                                                      data-toggle="tooltip" data-placement="top" data-original-title="#{bundle['dataset.cite.title.draft']}"/>
                                                <span class="glyphicon glyphicon-question-sign text-primary" jsf:rendered="#{FilePage.fileMetadata.datasetVersion.deaccessioned}"
                                                      data-toggle="tooltip" data-placement="top" data-original-title="#{bundle['dataset.cite.title.deassessioned']}"/>
                                            </div>
                                            <div class="pull-left row col-sm-9 padding-none"  jsf:rendered="#{!FilePage.anonymizedAccess}">
                                                <div class="col-sm-3 col-md-4 col-lg-3 btn-group margin-bottom citation-download" jsf:rendered="#{!FilePage.fileMetadata.datasetVersion.deaccessioned}">
                                                    <button type="button" class="btn btn-link dropdown-toggle padding-none downloadCitation" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                        #{bundle['dataset.cite.downloadBtn']} <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu">
                                                        <li>
                                                            <h:commandLink
                                                                id="endNoteLink" value="#{bundle['dataset.cite.downloadBtn.xml']}"
                                                                action="#{FilePage.fileDownloadService.downloadDatasetCitationXML(FilePage.fileMetadata.datasetVersion)}"
                                                            />
                                                        </li>
                                                        <li>
                                                            <h:commandLink
                                                                id="risLink" value="#{bundle['dataset.cite.downloadBtn.ris']}"
                                                                action="#{FilePage.fileDownloadService.downloadDatasetCitationRIS(FilePage.fileMetadata.datasetVersion)}"
                                                            />
                                                        </li>
                                                        <li>
                                                            <h:commandLink
                                                                id="bibLink" value="#{bundle['dataset.cite.downloadBtn.bib']}" target="_blank"
                                                                action="#{FilePage.fileDownloadService.downloadDatasetCitationBibtex(FilePage.fileMetadata.datasetVersion)}"
                                                            />
                                                        </li>
                                                    </ul>
                                                </div>
                                                <div class="col-sm-9 col-md-8 col-lg-9 text-muted margin-bottom citation-standards" jsf:rendered="#{!FilePage.fileMetadata.datasetVersion.deaccessioned}">
                                                    <h:outputText value="#{bundle['dataset.cite.standards.tip']}" escape="false"/>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- END: DATASET CITATION -->
                                </div>
                                <!-- END: CITATION BLOCK -->

                                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3 pull-right margin-bottom">
                                    <!-- ActionButtonBlock -->
                                    <div id="actionButtonBlock">
                                            <!-- DOWNLOAD/ACCESS DATASET -->
                                            <div class="btn-group btn-group-justified"
                                                 jsf:rendered="#{showAccessFileButtonGroup}">
                                                <div class="btn-group">
                                                    <button type="button" class="btn btn-primary btn-access-file dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                        #{bundle['file.accessBtn']} <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu pull-right text-left">
                                                        <!-- Explore/Download/Request Button Block -->
                                                        <ui:fragment rendered="#{!FilePage.fileMetadata.dataFile.filePackage
                                                                                   or FilePage.fileMetadata.dataFile.filePackage and systemConfig.HTTPDownload}">
                                                            <ui:include src="file-download-button-fragment.xhtml">
                                                                <ui:param name="fileMetadata" value="#{FilePage.fileMetadata}"/>
                                                                <ui:param name="guestbookAndTermsPopupRequired" value="#{FilePage.guestbookAndTermsPopupRequired}"/>
                                                                <ui:param name="requestAccessPopupRequired" value="#{FilePage.requestAccessPopupRequired}"/>
                                                                <ui:param name="guestbookResponse" value="#{FilePage.guestbookResponse}"/>
                                                                <ui:param name="guestbookResponseService" value="#{FilePage.guestbookResponseService}"/>
                                                                <ui:param name="fileDownloadService" value="#{FilePage.fileDownloadService}"/>
                                                                <ui:param name="isFilePg" value="true"/>
                                                                <ui:param name="lockedFromDownload" value="#{FilePage.lockedFromDownload}"/>
                                                                <ui:param name="exploreTools" value="#{FilePage.exploreTools}"/>
                                                                <ui:param name="queryTools" value="#{FilePage.queryTools}"/>
                                                                <ui:param name="anonymized" value="#{FilePage.anonymizedAccess}"/>
                                                                <ui:param name="bean" value="#{FilePage}"/>
                                                            </ui:include>
                                                        </ui:fragment>
                                                        <!-- END: Explore/Download/Request Button Block -->
                                                    </ul>
                                                </div>
                                            </div>

                                            <!-- Edit/Map Button Block -->
                                            <div class="btn-group btn-group-justified" jsf:rendered="#{!widgetWrapper.widgetView}">

                                                <!-- Edit Button Group -->
                                                <div class="btn-group" jsf:rendered="#{dataverseSession.user.authenticated
                                                                         and permissionsWrapper.canIssueUpdateDatasetCommand(FilePage.fileMetadata.datasetVersion.dataset)
                                                                         and FilePage.deletedFile}">
                                                    <p:commandLink styleClass="btn btn-default btn-access btn-edit" onclick="PF('fileAlreadyDeletedPrevious').show()"
                                                                   title="#{bundle['file.editBtn']}">
                                                        #{bundle['file.editBtn']}
                                                    </p:commandLink>
                                                </div>
                                                <div class="btn-group" jsf:rendered="#{dataverseSession.user.authenticated
                                                                         and permissionsWrapper.canIssueUpdateDatasetCommand(FilePage.fileMetadata.datasetVersion.dataset)
                                                                         and FilePage.hasValidTermsOfAccess
                                                                         and !FilePage.deletedFile}">
                                                    <button type="button" id="editFile" class="btn btn-default btn-access btn-edit dropdown-toggle #{FilePage.lockedFromEdits ? 'disabled' : ''}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                                                            disabled="#{FilePage.lockedFromEdits ? 'disabled' : ''}">
                                                        #{bundle['file.editBtn']} <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu pull-right text-left">
                                                        <ui:include src="file-edit-button-fragment.xhtml">
                                                            <ui:param name="datasetVersion" value="#{FilePage.fileMetadata.datasetVersion}"/>
                                                            <ui:param name="fileMetadata" value="#{FilePage.fileMetadata}"/>
                                                            <ui:param name="configureTools" value="#{FilePage.configureTools}"/>
                                                            <ui:param name="bean" value="#{FilePage}"/>
                                                            <ui:param name="unrestrictFileAction" value="restrictFile"/>
                                                        </ui:include>
                                                    </ul>
                                                </div>
                                                <!-- END: Edit Button Group -->

                                            </div>
                                            <!-- END: Map/Edit Button Block -->

                                            <!-- Contact/Share Button Group -->
                                            <div class="btn-group btn-group-justified" jsf:rendered="#{!widgetWrapper.widgetView}">
                                                <p:commandLink class="btn btn-default btn-xs btn-contact" title="#{bundle['dataset.email.datasetContactTitle']}"
                                                               update=":contactDialog" oncomplete="PF('contactForm').show()" actionListener="#{sendFeedbackDialog.initUserInput}">
                                                    <f:setPropertyActionListener target="#{sendFeedbackDialog.userMessage}" value=""/>
                                                    <f:setPropertyActionListener target="#{sendFeedbackDialog.userEmail}" value=""/>
                                                    <f:setPropertyActionListener target="#{sendFeedbackDialog.messageSubject}" value=""/>
                                                    <f:setPropertyActionListener target="#{sendFeedbackDialog.recipient}" value="#{FilePage.fileMetadata.dataFile}"/>
                                                    #{bundle['file.contactBtn']}
                                                </p:commandLink>
                                                <p:commandLink styleClass="btn btn-default btn-xs btn-share" rendered="#{!FilePage.fileMetadata.datasetVersion.deaccessioned}"
                                                               title="#{bundle['file.share.fileShare']}"
                                                               oncomplete="PF('shareDialog').show();sharrre();">
                                                    #{bundle['file.shareBtn']}
                                                </p:commandLink>
                                            </div>
                                            <!-- END: Contact/Share Button Group -->
                                    </div>
                                    <!-- END: ActionButtonBlock -->
                                </div>

                                <div style="clear:right;" class="col-xs-12 col-sm-12 col-md-4 col-lg-3 pull-right margin-bottom"
                                     jsf:rendered="#{!(widgetWrapper.widgetView or FilePage.fileMetadata.dataFile.filePackage or FilePage.fileMetadata.datasetVersion.deaccessioned)}">
                                    <!-- Metrics -->
                                    <div id="metrics-block">
                                        <div id="metrics-heading">
                                            #{bundle['metrics.file.title']}
                                            <ui:fragment rendered="#{!settingsWrapper.makeDataCountDisplayEnabled}">
                                                <span class="glyphicon glyphicon-question-sign tooltip-icon" data-toggle="tooltip" data-placement="auto top"
                                                    data-trigger="hover" data-original-title="#{bundle['metrics.file.tip.default']}"></span>
                                            </ui:fragment>
                                            <ui:fragment rendered="#{settingsWrapper.makeDataCountDisplayEnabled}">
                                                <a tabindex="0" role="button" class="glyphicon glyphicon-question-sign tooltip-icon" data-toggle="popover" data-placement="auto top"
                                                    data-trigger="focus" data-html="true" data-content="#{bundle['metrics.file.tip.makedatacount']}"></a>
                                            </ui:fragment>
                                        </div>
                                        <!-- END DATASET CITATION -->
                                        <div id="metrics-body">
                                            <!-- Classic downloads -->
                                            <div class="metrics-count-block" jsf:rendered="#{!settingsWrapper.makeDataCountDisplayEnabled}">
                                                <h:outputFormat value="{0} #{bundle['metrics.downloads']}">
                                                    <f:param value="#{guestbookResponseServiceBean.getDownloadCountByDataFileId(FilePage.fileId)}"/>
                                                </h:outputFormat>
                                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                                      data-toggle="tooltip" data-placement="auto top" data-original-title="#{bundle['metrics.file.downloads.tip']}"></span>
                                            </div>
                                            <!-- Make Data Count downloads -->
                                            <div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountDisplayEnabled}">
                                                <h:outputFormat value="{0} #{bundle['metrics.downloads']}">
                                                    <f:param value="#{guestbookResponseServiceBean.getDownloadCountByDataFileId(FilePage.fileId)}"/>
                                                </h:outputFormat>
                                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                                        data-toggle="tooltip" data-placement="auto top" data-original-title="#{bundle['metrics.file.downloads.nonmdc.tip']}"></span>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- END: Metrics -->
                                </div>

                                <!-- DEACCESSION ONLY?? NO SUMMARY BLOCK?? RESPONSIVE ORDER HACK BOOTSTRAP 3 https://stackoverflow.com/a/24834574 -->
                                <div jsf:rendered="#{FilePage.fileMetadata.datasetVersion.deaccessioned}"
                                     id="dataset-colorder-block" class="visible-md-block visible-lg-block col-md-8 col-lg-9"><!--Hack--></div>
                                <!-- END: RESPONSIVE ORDER HACK BOOTSTRAP 3 -->

                                <!-- DEACCESSION REASON -->
                                <div class="col-xs-12 col-sm-12 col-md-8 col-lg-9 margin-bottom" jsf:rendered="#{FilePage.fileMetadata.datasetVersion.deaccessioned}">
                                    <div id="deaccession-reason-block" class="col-xs-12 bg-danger">
                                        <h5 class="margin-top-half">#{bundle['dataset.deaccession.reason']}</h5>
                                        <p>#{FilePage.fileMetadata.datasetVersion.deaccessionNote}</p>
                                        <ui:fragment rendered="#{!empty FilePage.fileMetadata.datasetVersion.deaccessionLink}">
                                            <p>#{bundle['dataset.beAccessedAt']} 
                                                <h:outputLink rendered="#{FilePage.fileMetadata.datasetVersion.deaccessionLinkAsURLString ne null}" value="#{FilePage.fileMetadata.datasetVersion.deaccessionLinkAsURLString}" target="_blank">#{FilePage.fileMetadata.datasetVersion.deaccessionLink}</h:outputLink>
                                                <h:outputText rendered="#{FilePage.fileMetadata.datasetVersion.deaccessionLinkAsURLString eq null}" value="#{FilePage.fileMetadata.datasetVersion.deaccessionLink}"/>
                                                
                                            </p>
                                        </ui:fragment>
                                    </div>
                                </div>
                                <!-- END DEACCESSION REASON -->
                            </div>
                            <!-- END: NEW RESPONSIVE ABOVE FOLD BLOCK -->
                        </div>
                    </div>
                    <!-- END Top Button/Citation Blocks -->
                    <div id="contentTabs">
                        <p:tabView id="tabView" widgetVar="content" activeIndex="#{FilePage.selectedTabIndex}">
                            <p:ajax event="tabChange" listener="#{FilePage.tabChanged}" update="@this" />
                            <p:tab id="accessTab" class="padding-none" title="#{bundle['file.dataFilesTab.dataAccess']}"
                                   rendered="#{settingsWrapper.rsyncDownload and FilePage.fileMetadata.dataFile.filePackage and systemConfig.rsyncDownload
                                        and !FilePage.fileMetadata.getDataFile().getOwner().getStorageIdentifier().startsWith('s3://') }">
                                <!-- Access -->
                                <ui:include src="file-data-access-fragment.xhtml">
                                    <ui:param name="fileMetadata" value="#{fileMetadata}"/>
                                    <ui:param name="datasetVersion" value="#{FilePage.fileMetadata.datasetVersion}"/>
                                    <!--  Should be FilePage.fileDownloadService ? -->
                                    <ui:param name="fileDownloadService" value="#{FilePage.fileDownloadService}"/>
                                </ui:include>
                            </p:tab>
                            <p:tab id="previewTab" title="#{FilePage.toolTabTitle}"
                                   rendered="#{(FilePage.toolsWithPreviews.size() > 0 or FilePage.queryTools.size() > 0) and fileDownloadHelper.canDownloadFile(FilePage.fileMetadata)}">
                                <!-- PREVIEW TERMS/GUESTBOOK FORM -->
                                <ui:fragment rendered="#{FilePage.guestbookAndTermsPopupRequired and !FilePage.termsMet and (FilePage.getSelectedTool().previewTool or FilePage.getSelectedTool().queryTool)}">
                                    <ui:include id="previewGB" src="guestbook-terms-popup-fragment.xhtml">
                                        <ui:param name="popupContext" value="previewTab"/>
                                        <ui:param name="workingVersion" value="#{FilePage.fileMetadata.datasetVersion}"/>
                                        <ui:param name="guestbookAndTermsPopupRequired" value="#{FilePage.guestbookAndTermsPopupRequired}"/>
                                        <ui:param name="hasRestrictedFile" value="#{FilePage.fileMetadata.restricted}"/>
                                        <ui:param name="guestbookResponse" value="#{FilePage.guestbookResponse}"/>
                                        <ui:param name="guestbookResponseService" value="#{FilePage.guestbookResponseService}"/>
                                        <ui:param name="fileDownloadService" value="#{FilePage.fileDownloadService}"/>
                                        <ui:param name="lockedFromDownload" value="#{FilePage.lockedFromDownload}"/>
                                        <ui:param name="termsGuestbookPopupAction" value="#{bundle.download}"/>
                                        <ui:param name="guestbookPopupRequired" value="#{FilePage.guestbookPopupRequired}"/>
                                        <ui:param name="guestbookPopupRequiredAtDownload" value="#{FilePage.guestbookPopupRequiredAtDownload}"/>
                                    </ui:include>
                                </ui:fragment>
                                <!-- PREVIEW EXTERNAL TOOL -->
                                <ui:fragment rendered="#{(!FilePage.guestbookAndTermsPopupRequired) or FilePage.termsMet}">
                                <div class="btn-toolbar margin-bottom" role="toolbar" aria-label="#{bundle['file.previewTab.button.label']}">
                                    <!-- Preview Button Group -->
                                    <div class="btn-group" jsf:rendered="#{FilePage.allAvailableTools.size() > 1 and fileDownloadHelper.canDownloadFile(FilePage.fileMetadata)}">
                                        <button type="button" id="selectTool" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                             #{bundle['file.toolsTab.button.label']} <span class="caret"></span>
                                        </button>

                                        <ui:fragment rendered="#{FilePage.allAvailableTools.size() > 1}">
                                        <ul class="dropdown-menu">
                                            <ui:repeat value="#{FilePage.allAvailableTools}" var="tool">
                                                <li>
                                                    <h:commandLink action="#{FilePage.setSelectedTool(tool)}">
                                                        <h:outputText value="#{tool.getDisplayNameLang()}"/>
                                                    </h:commandLink>
                                                </li>
                                            </ui:repeat>
                                        </ul>
                                        </ui:fragment>
                                    </div>
                                    <!-- END: Preview Button Group -->
                                    <div class="btn-group" jsf:rendered="#{(FilePage.toolsWithPreviews.size() > 0 or FilePage.queryTools.size() > 0) and fileDownloadHelper.canDownloadFile(FilePage.fileMetadata)}">
                                        <!-- Modular/Configured Explore Tool -->
                                        <ui:remove><!-- Not sure this div will ever be rendered when terms are required and FilePage.termsMet isn't true. Leaving this logic in in case that is incorrect or changes going forward --></ui:remove>

                                        <h:commandLink rendered="#{(!FilePage.guestbookAndTermsPopupRequired) or FilePage.termsMet}"
                                                         type="submit"
                                                         styleClass="btn btn-default #{(FilePage.fileMetadata.dataFile.ingestInProgress) ? 'disabled' : ''}"
                                                         disabled="#{(FilePage.fileMetadata.dataFile.ingestInProgress or lockedFromDownload) ? 'disabled' : ''}"
                                                         action="#{FilePage.fileDownloadService.explore(FilePage.guestbookResponse, FilePage.fileMetadata, FilePage.selectedTool)}">
                                            <span class="glyphicon glyphicon-#{FilePage.selectedTool.exploreTool ? 'equalizer' : 'new-window'}"></span>
                                            <h:outputFormat value="#{FilePage.selectedTool.exploreTool ? bundle['file.previewTab.exploreBtn'] : bundle['file.previewTab.openBtn']}">
                                                <f:param value="#{bundle.explore}"/>
                                                <f:param value="#{FilePage.selectedTool.getDisplayNameLang()}"/>
                                            </h:outputFormat>
                                        </h:commandLink>
                                        <p:commandLink rendered="#{FilePage.guestbookAndTermsPopupRequired and !FilePage.termsMet}"
                                                         action="#{FilePage.guestbookResponseService.modifyDatafileAndFormat(FilePage.guestbookResponse, FilePage.fileMetadata, 'externalTool', FilePage.selectedTool)}"
                                                         styleClass="btn btn-default"
                                                         disabled="#{(FilePage.fileMetadata.dataFile.ingestInProgress or lockedFromDownload) ? 'disabled' : ''}"
                                                         type="submit"
                                                         process="@this"
                                                         update="@widgetVar(guestbookAndTermsPopup)"
                                                         oncomplete="PF('guestbookAndTermsPopup').show();handleResizeDialog('guestbookAndTermsPopup');">
                                            <f:actionListener binding="#{FilePage.setTermsGuestbookPopupAction(bundle.download)}"/>
                                            <span class="glyphicon glyphicon-#{FilePage.selectedTool.exploreTool ? 'equalizer' : 'new-window'}"></span>
                                            <h:outputFormat value="#{FilePage.selectedTool.exploreTool ? bundle['file.previewTab.exploreBtn'] : bundle['file.previewTab.openBtn']}">
                                                <f:param value="#{bundle.explore}"/>
                                                <f:param value="#{FilePage.selectedTool.getDisplayNameLang()}"/>
                                            </h:outputFormat>
                                        </p:commandLink>
                                    </div>
                                </div>
                                <!-- FRAME EXTERNAL TOOL EMBED -->
                                <div id="previewPresentation" class="embed-responsive embed-responsive-16by9" jsf:rendered="#{(FilePage.toolsWithPreviews.size() > 0  or FilePage.queryTools.size() > 0) and fileDownloadHelper.canDownloadFile(FilePage.fileMetadata)}">
                                    <iframe role="presentation" title="#{bundle['file.previewTab.presentation']}" src="#{FilePage.preview(FilePage.selectedTool)}"></iframe>
                                </div>
                                </ui:fragment>
                            </p:tab>
                            <p:tab id="metadataMapTab" class="padding-none" title="#{bundle['file.dataFilesTab.metadata.header']}"
                                   rendered="#{(!FilePage.fileMetadata.datasetVersion.deaccessioned or
                                                              (FilePage.fileMetadata.datasetVersion.deaccessioned and FilePage.canUpdateDataset()))}">
                                <!-- Metadata -->
                                <div class="button-block tab-header margin-bottom text-right">
                                    <!-- Add + Edit Metadata Button -->
                                    <h:outputLink styleClass="btn btn-default btn-access #{FilePage.lockedFromEdits ? 'disabled' : ''}"
                                                  value="/editdatafiles.xhtml?selectedFileIds=#{FilePage.fileMetadata.dataFile.id}&#38;datasetId=#{FilePage.fileMetadata.datasetVersion.dataset.id}&#38;referrer=FILE"
                                                  rendered="#{!widgetWrapper.widgetView and (dataverseSession.user.authenticated
                                                     and permissionsWrapper.canIssueUpdateDatasetCommand(FilePage.fileMetadata.datasetVersion.dataset)
                                                     and !FilePage.deletedFile)}"
                                                  disabled="#{FilePage.lockedFromEdits ? 'disabled' : ''}">
                                        <span class="glyphicon glyphicon-pencil"/> #{bundle['file.dataFilesTab.metadata.addBtn']}
                                    </h:outputLink>
                                    <div class="btn-group" jsf:rendered="#{!widgetWrapper.widgetView and (dataverseSession.user.authenticated
                                                         and permissionsWrapper.canIssueUpdateDatasetCommand(FilePage.fileMetadata.datasetVersion.dataset)
                                                         and (FilePage.deletedFile))}">
                                        <button class="btn btn-default btn-access #{FilePage.lockedFromEdits ? 'disabled' : ''}" onclick="PF('fileAlreadyDeletedPrevious').show()" type="button"
                                                disabled="#{FilePage.lockedFromEdits ? 'disabled' : ''}">
                                            <span class="glyphicon glyphicon-pencil"/> #{bundle['file.dataFilesTab.metadata.addBtn']}
                                        </button>
                                    </div>
                                    <!-- Export Button -->
                                    <div class="btn-group" jsf:rendered="#{FilePage.fileMetadata.datasetVersion.dataset.released}">
                                        <button class="btn btn-default btn-export dropdown-toggle" type="button" data-toggle="dropdown">
                                            <span class="glyphicon glyphicon-export"/> #{bundle['dataset.exportBtn']} <span class="caret"/>
                                        </button>
                                        <ul class="dropdown-menu pull-right text-left">
                                            <ui:repeat var="exporter" value="#{FilePage.getExporters()}">
                                                <li>
                                                    <h:outputLink value="#{exporter[1]}" target="_blank">
                                                        <h:outputText value="#{exporter[0]}"/>
                                                    </h:outputLink>
                                                </li>
                                            </ui:repeat>
                                        </ul>
                                    </div>
                                </div>
                                <div class="panel panel-default">
                                    <div data-toggle="collapse" data-target="#panelCollapseFMD" class="panel-heading text-info">
                                        #{bundle['file.metadataTab.fileMetadata.header']} &#160;<span class="glyphicon glyphicon-chevron-up"/>
                                    </div>
                                    <div id="panelCollapseFMD" class="collapse in">
                                        <div class="panel-body metadata-container">
                                            <table class="metadata">
                                                <tbody>
                                                    <tr id="filePreviewBlock">
                                                        <th scope="row">
                                                            #{bundle['file.metadata.preview']}
                                                        </th>
                                                        <td>
                                                            <div id="file-preview-icon-block">
                                                                <div id="border-block" style="border:0;">
                                                                    <div id="preview-square">
                                                                        <span class="icon-#{dataFileServiceBean.getFileThumbnailClass(FilePage.fileMetadata.dataFile)} text-muted" jsf:rendered="#{!FilePage.isThumbnailAvailable(FilePage.fileMetadata)}"/>
                                                                        <p:graphicImage styleClass="img-responsive" value="/api/access/datafile/#{FilePage.fileId}?imageThumb=400"
                                                                                        alt="#{FilePage.fileMetadata.label}" rendered="#{FilePage.isThumbnailAvailable(FilePage.fileMetadata)}"/>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr id="fileCategoriesBlock" jsf:rendered="#{!(empty FilePage.fileMetadata.categoriesByName) or !(empty FilePage.fileMetadata.dataFile.tags)}">
                                                        <th scope="row">
                                                            #{bundle['file.metadata.filetags']}
                                                        </th>
                                                        <td id="fileCategoriesList"   >
                                                            <div id="file-tags" >
                                                                <ui:repeat value="#{FilePage.fileMetadata.categoriesByName}" var="tag">
                                                                    <h:outputText value="#{tag}" styleClass="label label-default" />
                                                                </ui:repeat>
                                                                <ui:repeat value="#{FilePage.fileMetadata.dataFile.tagLabels}" var="tag" varStatus="loop" >
                                                                    <h:outputText value="#{loop.first ? '&lt;br/&gt;': '' }" escape="false"/>
                                                                    <h:outputText value="#{tag}" styleClass="label label-info"/>
                                                                </ui:repeat>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr id="filePersistentIdBlock" jsf:rendered="#{FilePage.file.identifier != null}">
                                                        <th scope="row">
                                                            #{bundle['file.metadata.persistentId']}
                                                        </th>
                                                        <td>#{FilePage.file.getGlobalId()}</td>
                                                    </tr>
                                                    <tr id="fileDownloadUrlBlock" jsf:rendered="#{FilePage.publiclyDownloadable and !FilePage.fileMetadata.dataFile.filePackage}">
                                                        <!--Only show Public download url if identifier is available -->
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.downloadUrl.label']}
                                                        </th>
                                                        <td>
                                                            <p class="help-block">
                                                                <h:outputFormat value="#{bundle['file.metadataTab.fileMetadata.downloadUrl.info']}" escape="false">
                                                                    <f:param value="#{systemConfig.guidesBaseUrl}"/>
                                                                    <f:param value="#{systemConfig.guidesVersion}"/>
                                                                </h:outputFormat>
                                                            </p>
                                                            <code><h:outputText value="#{FilePage.publicDownloadUrl}"/></code>
                                                        </td>
                                                    </tr>
                                                    <tr id="fileUnfBlock" jsf:rendered="#{!(empty FilePage.file.unf)}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.unf.label']}
                                                        </th>
                                                        <td>#{FilePage.file.unf}</td>
                                                    </tr>
                                                    <tr id="fileChecksumBlock" jsf:rendered="#{!(empty FilePage.file.checksumValue)}">
                                                        <th scope="row">
                                                            #{FilePage.file.tabularData ? FilePage.file.originalChecksumType : FilePage.file.checksumType}
                                                        </th>
                                                        <td class="checksum-block">#{FilePage.file.checksumValue}</td>
                                                    </tr>
                                                    <tr id="fileDepositDateBlock">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.depositDate.label']}
                                                        </th>
                                                        <td>#{FilePage.file.createDateFormattedYYYYMMDD}</td>
                                                    </tr>
                                                    <tr id="metadataReleaseDateBlock" jsf:rendered="#{FilePage.file.released}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.metadataReleaseDate.label']}
                                                        </th>
                                                        <td>#{FilePage.file.publicationDateFormattedYYYYMMDD}
                                                        </td>
                                                    </tr>
                                                    <tr id="fileEPublicationDateBlock" jsf:rendered="#{FilePage.file.released or !(empty FilePage.file.embargo) or !(empty FilePage.file.retention)}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.publicationDate.label']}
                                                        </th>
                                                        <td>#{(empty FilePage.file.embargo) and !(empty FilePage.file.released) and !(empty FilePage.file.retention) ? ''.concat(FilePage.file.publicationDateFormattedYYYYMMDD).concat('; ') : ''}
                                                            #{!(empty FilePage.file.embargo) ? ''.concat(FilePage.embargoPhrase).concat(' ').concat(FilePage.file.embargo.dateAvailable) : ''}
                                                            #{!(empty FilePage.file.embargo) and !(empty FilePage.file.retention) ? '; ': ''}
                                                            #{!(empty FilePage.file.retention) ? ''.concat(FilePage.retentionPhrase)
                                                              .concat(' ').concat(FilePage.file.retention.dateUnavailable)
                                                              .concat(', ').concat(bundle['retention.enddateinfo'])
                                                            : ''}
                                                            #{(empty FilePage.file.embargo and empty FilePage.file.retention)? FilePage.file.publicationDateFormattedYYYYMMDD : ''}
                                                        </td>
                                                    </tr>
                                                    <tr id="fileEmbargoBlock" jsf:rendered="#{!(empty FilePage.file.embargo) and ! (empty FilePage.file.embargo.reason)}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.embargoReason.label']}
                                                        </th>
                                                        <td>#{FilePage.file.embargo.reason}
                                                        </td>
                                                    </tr>
                                                    <tr id="fileRetentionBlock" jsf:rendered="#{!(empty FilePage.file.retention) and ! (empty FilePage.file.retention.reason)}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.retentionReason.label']}
                                                        </th>
                                                        <td>#{FilePage.file.retention.reason}
                                                        </td>
                                                    </tr>
                                                    <tr id="fileSizeBlock" jsf:rendered="#{!(empty FilePage.file.friendlySize)}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.size.label']}
                                                        </th>
                                                        <td>#{FilePage.file.friendlySize}</td>
                                                    </tr>
                                                    <tr id="fileTypeBlock" jsf:rendered="#{!(empty FilePage.file.friendlyType)}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.type.label']}
                                                        </th>
                                                        <td>#{FilePage.file.friendlyType}</td>
                                                    </tr>
                                                    <tr id="fileVariablesBlock" jsf:rendered="#{!(empty FilePage.file.dataTable.varQuantity)}">
                                                        <th scope="row">
                                                            #{bundle['file.metaData.dataFile.dataTab.variables']}
                                                        </th>
                                                        <td>#{FilePage.file.dataTable.varQuantity}</td>
                                                    </tr>
                                                    <tr id="fileObservationsBlock" jsf:rendered="#{!(empty FilePage.file.dataTable.caseQuantity)}">
                                                        <th scope="row">
                                                            #{bundle['file.metaData.dataFile.dataTab.observations']}
                                                        </th>
                                                        <td>#{FilePage.file.dataTable.caseQuantity}</td>
                                                    </tr>
                                                    <tr id="filePathBlock" jsf:rendered="#{!empty FilePage.fileMetadata.directoryLabel}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.hierarchy.label']}
                                                        </th>
                                                        <td>#{FilePage.fileMetadata.directoryLabel}/</td>
                                                    </tr>
                                                    <tr id="fileDescriptionBlock" jsf:rendered="#{!(empty FilePage.fileMetadata.description)}">
                                                        <th scope="row">
                                                            #{bundle['file.metadataTab.fileMetadata.description.label']}
                                                        </th>
                                                        <td>#{FilePage.fileMetadata.description}</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </p:tab>
                            <p:tab id="versionsTab" title="#{bundle['file.dataFilesTab.versions']}">
                                <!-- Versions -->
                                <ui:include src="file-versions.xhtml">
                                  <ui:param name="anonymized" value="#{FilePage.anonymizedAccess}"/>
                                </ui:include>
                            </p:tab>
                        </p:tabView>
                    </div>
                    <!-- POPUPS -->
                    <ui:include src="file-edit-popup-fragment.xhtml" rendered="#{dataverseSession.user.authenticated and FilePage.canUpdateDataset()}">
                        <ui:param name="datasetVersion" value="#{FilePage.fileMetadata.datasetVersion}"/>
                        <ui:param name="bean" value="#{FilePage}"/>
                        <ui:param name="restrictFileAction" value="restrictFile"/>
                        <ui:param name="deleteFileAction" value="deleteFile"/>
                        <ui:param name="saveEmbargoAction" value="saveEmbargo"/>
                        <ui:param name="saveRetentionAction" value="saveRetention"/>
                        <ui:param name="updateElements" value=":fileForm:embargoInputs"/>
                        <ui:param name="updateRetentionElements" value=":fileForm:retentionInputs"/>

                    </ui:include>
                    <p:dialog id="shareDialog" header="#{bundle['file.share.title']}" widgetVar="shareDialog" modal="true" rendered="#{!FilePage.fileMetadata.datasetVersion.deaccessioned}">
                        <p class="help-block">#{bundle['file.share.tip']}</p>
                        <div id="sharrre-widget" data-text="#{bundle['file.share.text']}" data-url="#{systemConfig.dataverseSiteUrl}/file.xhtml?#{empty FilePage.fileMetadata.dataFile.globalId ? 'fileId' : 'persistentId'}=#{empty FilePage.fileMetadata.dataFile.globalId ? FilePage.fileMetadata.dataFile.id : FilePage.fileMetadata.dataFile.globalId.asString()}&amp;version=#{FilePage.fileMetadata.datasetVersion.friendlyVersionNumber}"></div>
                        <div class="button-block">
                            <button class="btn btn-default" onclick="PF('shareDialog').hide()" type="button">
                                #{bundle.close}
                            </button>
                        </div>
                    </p:dialog>

                    <p:dialog id="downloadPackagePopup" styleClass="smallPopUp" header="#{bundle['packageDownload.title']}" widgetVar="downloadPackagePopup" modal="true">
                         <ui:include src="package-download-popup-fragment.xhtml">
                            <ui:param name="workingVersion" value="#{FilePage.fileMetadata.datasetVersion}"/>
                            <ui:param name="guestbookAndTermsPopupRequired" value="#{FilePage.guestbookAndTermsPopupRequired}"/>
                            <ui:param name="guestbookResponse" value="#{FilePage.guestbookResponse}"/>
                            <ui:param name="guestbookResponseService" value="#{FilePage.guestbookResponseService}"/>
                            <ui:param name="fileDownloadService" value="#{FilePage.fileDownloadService}"/>
                            <ui:param name="lockedFromDownload" value="#{FilePage.lockedFromDownload}"/>
                        </ui:include>
                    </p:dialog>
                    <p:dialog id="guestbookAndTermsPopup" styleClass="largePopUp" header="#{bundle['file.downloadDialog.header']}" widgetVar="guestbookAndTermsPopup" modal="true">
                        <o:importFunctions type="edu.harvard.iq.dataverse.util.MarkupChecker" />
                        <ui:include src="guestbook-terms-popup-fragment.xhtml">
                            <ui:param name="workingVersion" value="#{FilePage.fileMetadata.datasetVersion}"/>
                            <ui:param name="someActivelyEmbargoedFiles" value="#{FilePage.cantRequestDueToEmbargo}"/>
                            <ui:param name="guestbookAndTermsPopupRequired" value="#{FilePage.guestbookAndTermsPopupRequired}"/>
                            <ui:param name="guestbookResponse" value="#{FilePage.guestbookResponse}"/>
                            <ui:param name="fileDownloadHelper" value="#{FilePage.fileDownloadHelper}"/>
                            <ui:param name="fileDownloadService" value="#{FilePage.fileDownloadService}"/>
                            <ui:param name="termsGuestbookPopupAction" value="#{FilePage.termsGuestbookPopupAction}"/>
                            <ui:param name="guestbookPopupRequired" value="#{FilePage.guestbookPopupRequired}"/>
                            <ui:param name="guestbookPopupRequiredAtDownload" value="#{FilePage.guestbookPopupRequiredAtDownload}"/>

                        </ui:include>
                    </p:dialog>
                    <ui:include rendered="#{systemConfig.provCollectionEnabled}" src="provenance-popups-fragment.xhtml">
                        <ui:param name="saveInPopup" value="true"/>
                    </ui:include>
                    <!-- Request Access Sign Up/Log In Button -->
                    <p:dialog id="accessGuest" header="#{bundle['file.requestAccess']}" widgetVar="accessSignUpLogIn_popup" modal="true">
                        <p class="help-block">
                            <span class="glyphicon glyphicon-exclamation-sign text-danger"/>&#160;
                            <h:outputFormat styleClass="text-danger" value="#{dataverseHeaderFragment.signupAllowed ? bundle['file.requestAccess.dialog.msg.signup'] : bundle['file.requestAccess.dialog.msg']}" escape="false">
                                <f:param value="#{navigationWrapper.redirectPage}"/>
                                <f:param value="#{dataverseHeaderFragment.getSignupUrl(navigationWrapper.redirectPage)}"/>
                                <f:param value="#{widgetWrapper.widgetView ? '_blank' : '_self'}"/>
                            </h:outputFormat>
                        </p>
                        <div class="button-block">
                            <button class="btn btn-default" onclick="PF('accessSignUpLogIn_popup').hide();" type="button">
                                #{bundle.close}
                            </button>
                        </div>
                    </p:dialog>
                    <p:dialog id="computeAccessDenied" styleClass="smallPopUp" header="#{bundle['dataset.compute.computeBtn']}" widgetVar="computeAccessDeniedPopup" modal="true">
                        <p class="text-danger"><span class="glyphicon glyphicon-exclamation-sign"/> #{bundle['file.compute.fileAccessDenied']}</p>
                        <div class="button-block">
                            <button class="btn btn-default" onclick="PF('computeAccessDeniedPopup').hide();" type="button">
                                #{bundle.close}
                            </button>
                        </div>
                    </p:dialog>
                </h:form>
                <script>
                    //<![CDATA[
                    function editTerms(){
                        PF('accessPopup').show();
                    }
                    //]]>
                </script>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
